package com.object.oriented.exam.system6.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.object.oriented.exam.system1.entity.Result;
import com.object.oriented.exam.system6.entity.Student;
import com.object.oriented.exam.system6.service.StudentManageService;
import com.object.oriented.exam.system8.entity.Question;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author Lanh
 * @date 2023.06.18 19:10
 **/

@RestController
@RequestMapping("/student_manage")
public class StudentMangeController {

    @Autowired
    private StudentManageService studentManageService;

    @GetMapping("/listStudent")
    public Result listStudent(){
        return studentManageService.listStudent();
    }

    @PostMapping("/addStudent")
    public Result addStudent(@RequestBody Student student){
        return studentManageService.insert(student);
    }

    @PostMapping("/updateStudent")
    public Result updateStudent(@RequestBody Student student){
        return studentManageService.update(student);
    }

    @PostMapping("/delStudent")
    public Result delStudent(@RequestBody Student student){
        return studentManageService.delete(student);
    }

    @GetMapping("/listStudentExamScore")
    public Result listStudentExamScore(@RequestParam("studentId")int studentId){
        return studentManageService.listStudentExamScore(studentId);
    }

    /**
     * 获取学生错题分析
     * @param studentId
     * @return
     */
    @GetMapping("/errKnowledgeAnalyze")
    public Result errKnowledgeAnalyze(@RequestParam("studentId") int studentId){
        return studentManageService.errKnowledgeAnalyze(studentId);
    }


}
